<script>
import Vue from 'vue'
import * as Main_API from '@/api/main/home.js' 
	export default {
		onLaunch: function() {
			uni.getSystemInfo({
				success: function(e) {
					// #ifndef MP
					Vue.prototype.StatusBar = e.statusBarHeight;
					if (e.platform == 'android') {
						Vue.prototype.CustomBar = e.statusBarHeight + 50;
					} else {
						Vue.prototype.CustomBar = e.statusBarHeight + 45;
					};
					// #endif
					// #ifdef MP-WEIXIN || MP-QQ
					Vue.prototype.StatusBar = e.statusBarHeight;
					let capsule = wx.getMenuButtonBoundingClientRect();
					if (capsule) {
						Vue.prototype.Custom = capsule;
						// Vue.prototype.capsuleSafe = uni.upx2px(750) - capsule.left + uni.upx2px(750) - capsule.right;
						Vue.prototype.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
					} else {
						Vue.prototype.CustomBar = e.statusBarHeight + 50;
					}
					// #endif		
					// #ifdef MP-ALIPAY
					Vue.prototype.StatusBar = e.statusBarHeight;
					Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
					// #endif
				}
			})
	},
	onShow: function(e) {
		console.log('app Show',e)
		// 普通分享
		if(e.query.sharePhone){
			uni.removeStorage('referrer')
			uni.setStorageSync('referrer',{'phone':e.query.sharePhone})
		}
		if(e.query.shop_id){
			this.getShopInfo(e.query.shop_id)
		}
	},
	onHide: function() {
		console.log('App Hide');
	},
	methods:{
		getShopInfo(shop_id){
			console.log('shop_id',shop_id)
			Main_API.getShopInfo(shop_id).then(res=>{
				if(res.shop_id){
					uni.removeStorageSync('shop')
					uni.setStorageSync('shop',res)
				}
			})
		}
	}
};
</script>

<style lang="scss">
	@import "./common/colorui/main.css";
	@import "./common/colorui/icon.css";
	@import "./common/colorui/animation.css";
	.page{
		height: 100vh;
		background: $background-container;
	}
	.page-content{
		padding-bottom: 90rpx;
	}
	.radius12{
		border-radius: 12upx;
	}
	.radius20{
		border-radius: 20upx;
	}
	.title_line_1{
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
	}
	.title_line_2{
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}
	.overHidden{
		overflow: hidden;
	}
	.wq-order-text-orange{
		color:#ff6a22
	}
	.wq-linethrough{
		text-decoration:line-through;
	}
	.wq-icon-orange{
		color: #FB8C00;
	}
	.bg-join-cart{
		background:#FFA531;
	}
	.wq-lheight-15{
		line-height: 30upx;
	}
	.bg-gradual-theme{
		background-image: linear-gradient(45deg, $color-main, $color-main);
		color: #ffffff;
	}
	.bg-theme{
		background: $color-main;
		color: #ffffff;
	}
	.text-theme{
		color: $color-main;
	}
	.text-theme,
	.line-theme,
	.lines-theme {
		color: $color-main;
	}
	.line-theme::after {
		border-color: $color-main;
	}
	.text-pay,
	.line-pay,
	.lines-pay {
		color: #F2854C;
	}
	.line-pay::after {
		border-color: #F2854C;
	}
	
	.avatar-bg{
		background-position: 100% 100%;
		background-size: cover;
		width: 140rpx;
		height: 140rpx;
		padding-top: 10rpx;
	}
	.avatar_img{
		width:120rpx;
		height:120rpx;
		border-radius: 60rpx;
		overflow: hidden;
	}
	.commment-icon{
		width: 28rpx;
		height: 28rpx;
		margin-right: 5rpx;
	}
	.text-333{
		color: #333;
	}
	.text-999{
		color:#999;
	}
	.text-fw500{
		font-weight: 500;
	}
	.text-fw600{
		font-weight: 600;
	}
	.bg-lightGrey{
		background-color: $background-lightGrey;
	}
	.border-bottom-1{
		border-bottom:  1px solid #E1E1E1;;
	}
	.flex-1{
		flex: 1;
	}
	.goodsImg{
		width: 180upx;
		height: 180upx;
	}
	switch.theme[checked] .wx-switch-input,
	checkbox.theme[checked] .wx-checkbox-input,
	radio.theme[checked] .wx-radio-input,
	switch.theme.checked .uni-switch-input,
	checkbox.theme.checked .uni-checkbox-input,
	radio.theme.checked .uni-radio-input {
		background-color: $color-main !important;
		border-color: $color-main !important;
		color: $color-main !important;
	}
	.orderIcon{
		width: 40rpx;
		background-color: #fff;
		background-size: cover;
	}
	.flexLine{
		width: 100%;
		display: flex;
		justify-content: space-between; 
		margin-top: 10rpx;
	}
</style>
